Expression Evaluator Script

The Expression Evaluator (SYSLIB_EXPREVAL) is a system library HyperPoint. It uses a script library file called EXPRESSIONEVALUATOR_SCRIPTS.TXT to build and evaluate an expression defined in a Library User HyperPoint and sets the resulting value to a target point. It has error-checking in the code. The script is triggered by changes to the points referenced in the expression. Every 10 seconds, the Library HyperPoint checks for changes to the points in the expression. The script for the SYSLIB_EXPREVAL Library HyperPoint is stored in the CygNet\Utilities\SCRIPTLIBRARY folder on your host server. The library point is installed using the CygNet Point Script Copy Utility.

The expression is specified in the External ID field of the Point Reference page of the Library User HyperPoint. It can include any VBScript operator(s). The External ID field is limited to 256 characters.

External ID field

External ID field

The point identifiers in the expression must use the Long Point ID and be contained in braces. The script assumes the Site and Service reference UIS points in the same site. If not, you must identify the points using the long tag string format (Site.Service:Facility_UDC). For example, a Current Value Service other than a UIS in the same site as the HSS, and any CVS (HSS, OPCIS, SVCMON, and UIS) in another site requires the long tag string format.

In the examples in the table below, the points are within the braces, while the parentheses indicate the order of operations.

Note: If a user chooses to use relational operators, note that when you convert Boolean values to numeric types by using conversion keywords in Visual Basic, False becomes zero and True becomes -1. See the CBool conversion type.

Sample Type Expression (Data in same site as HSS) Expression (Different site and service)

Average

({MESA_VGT}+{AZTEC_VGT})/2

({MYSITE.UIS:MESA_VGT}+{MYSITE.OPCIS:AZTEC_VGT})/2

Sum

{MESA_VGT}+{AZTEC_VGT}

{MYSITE.UIS:MESA_VGT}+{MYSITE.OPCIS:AZTEC_VGT}

For more information, see the following subsections below:

Create the SYSLIB_EXPREVAL Library HyperPoint

The system library file EXPRESSIONEVALUATOR_SCRIPTS.TXT contains the script required to run the Expression Evaluator.

To Install the Expression Evaluator Script

  1. Using Windows Explorer, browse to the CygNet\Utilities directory on the host server.
  2. Locate and double-click the CygNet Point Script Copy Utility program executable (PointCfgScriptCopy.exe).
  3. In the PointCfg Service drop-down menu, select the Point Service (PNT) to which you want to copy the script.
  4. In the Target HSS Service drop-down menu, select the HyperPoint Scripting Service (HSS) to which you want to copy the script.
  5. In the Script Copy Source (Copy From) area, select the From File option.
  6. Click the Browse button beside the From File field and browse to the directory that contains the EXPRESSIONEVALUATOR_SCRIPTS.TXT file. This is typically CygNet\Utilities\ScriptLibrary.
  7. Select the EXPRESSIONEVALUATOR_SCRIPTS.TXT file and click Open.
  8. In the Script Copy Target (Copy to) area, select To Default Service Point in Source.
  9. Click Test Copy to validate the copy. Closely read all test messages and resolve any errors before proceeding.
  10. If you are ready to perform a live copy, click Perform Copy to copy the script into the selected PNT and HSS.
  11. Click Yes if you are sure you want to copy the selected script. A new Library HyperPoint is created.
  12. In the HSS in CygNet Explorer, right click the newly created Library HyperPoint and select Point Configuration from the drop-down menu.
  13. Click Edit and ensure that the HyperPoint and Activate Script check boxes are selected on the General tab.
  14. Click Save.

The following image displays a section of a HyperPoint page for a Library HyperPoint.

HyperPoint page

HyperPoint page

Back to top

Create the Target Point for the Expression

The target point can be any Current Value Service (HSS, OPCIS, SVCMON, and UIS) point.

To Create the Target Point

  1. Using CygNet Explorer, open the Point Service (PNT) in the service hierarchy.
  2. Right-click in the white space in the PNT service pane and click New.
  3. In the Site.service field, click and select the desired current value service.
  4. In the Facility ID field, type the Facility ID name or click to select the appropriate facility.
  5. In the Uniform data code box, type the UDC name or click to select the appropriate UDC.
  6. Set the Point Type to Analog Input.
  7. Click OK.

Create the Library User HyperPoint

A Library User HyperPoint must be created to run the Expression Evaluator script.

To Create a Library User HyperPoint

  1. Using CygNet Explorer, open the Point Service (PNT) in the service hierarchy.
  2. Right-click in the white space in the PNT service pane and click New.
  3. In the Site.service field, click and select your HSS.
  4. In the Facility ID field, enter the same facility used for the target point.
  5. In the Uniform data code box, enter the same UDC used for the target point.
  6. Ensure that the HyperPoint and Activate Script check boxes are selected.
  7. Click to check HyperPoint.
  8. Click to check Activate Script.
  9. Set the Point Type to String Input.
  10. Select the HyperPoint page.
  11. Set the HyperPoint type to Library User HyperPoint.
  12. Click the Use library HyperPoint field browse button and select SYSLIB_EXPREVAL.
  13. Select the Point reference page.
  14. Click the Choose point button, change the CVS Site.Service to your UIS, and refresh the view.
  15. Select the target point you created.
  16. In the External ID field, enter the expression.
  17. Click Save. The Library User HyperPoint value displayed indicates the script’s running status.

Back to top

The following table lists and describes some of the possible values of the script's running status.

Value Description
Reg:TM:<#> RegisterExpressionPoints status.

Note: Typically <#> is tag count, but can also be an error type.

Err:PC:EXPR No expression indicated.
Err:PC:LNGID No target point indicated.
Err:PC:SITE No site indicated.
Err:PC:SVC No service indicated.
Err:PC:PARSE Failure to parse expression.
Err:PC:REPLACE Failure to replace Long IDs with literals.
Err:PC:EVAL Evaluation fails to return a value.
Err:PC:SET SetPointEX failure.
Eval:<vResult> New value written to target on point change.

Troubleshooting

Perform the following steps if the script fails to run:

  1. Check the value of the Library User HyperPoint in the HSS for an error message.
  2. Use CygNet Console to check HSS system messages. If the console shows an error on a specific line, use Notepad to open the Script.txt file (stored in the CygNet\Services\HSS folder).
  3. Check the HSS_Script<xxx>.log in the CygNet\Services\HSS folder for errors.
  4. Ensure that the LOGMASK_SCRIPT keyword in the Hss.cfg file is set to LOG_ALL.

Perform the following steps to verify the settings of the target point:

  1. Verify the Point ID of the trigger point on the Point reference page of the Library User HyperPoint.
  2. Verify the IDs of the points identified in the expression and make sure they are in the Long ID format.

Back to top